
from selenium.webdriver.common.by import By

from autoTest_ecshop_new.base_page.base import BasePage

class LoginPage(BasePage):
    # 用户名定位器
    username_loc = (By.CSS_SELECTOR,'[name="username"]')

    # 密码定位器
    password_loc = (By.CSS_SELECTOR, '[name="password"]')

    # 登录按钮定位器
    loginBtn_loc = (By.CSS_SELECTOR, '[name="submit"]')
    # 实际结果定位器
    homePage_loc = ((By.CSS_SELECTOR, '[id="ECS_MEMBERZONE"] >font'))

    #用户名错误的定位器
    usernameErr_loc = (By.XPATH,'//div[@align="center"]/div/p[1]')

    #passwordErr_loc = (By.XPATH,'//div[@align="center"]/div/p[2]')

    def loginSystem(self, username, password):
        # 输入用户名
        self.input_data(self.username_loc, username)
        # 输入密码
        self.input_data(self.password_loc, password)
        # 点击登录
        self.click_btn(self.loginBtn_loc)





